//
//  DayDataCtr.m
//  YetcarText
//
//  Created by ming on 17/9/5.
//  Copyright © 2017年 ming. All rights reserved.
//

#import "DayDataCtr.h"
#import "DataTopView.h"
#import "PNChartDelegate.h"
#import "PNChart.h"
@interface DayDataCtr ()<PNChartDelegate>
@property (nonatomic) PNBarChart * barChart;

@end

@implementation DayDataCtr

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor=[UIColor whiteColor];
    [self setTopView];
}
-(void)setTopView{
    DataTopView *dataTopView=[[DataTopView alloc]initWithFrame:CGRectMake(0, 0, Main_Screen_Width, Main_Screen_Height*0.3)];
    [self.view addSubview:dataTopView];
    
    dataTopView.callBack=^(NSInteger tag){
    
    
    };
    UIView *line=[UIView new];
    line.backgroundColor=[UIColor blackColor];
    line.frame=CGRectMake(0, Main_Screen_Height*0.3+30, Main_Screen_Width, 0.5);
    [self.view addSubview:line];
    
    UILabel *lable=[UILabel new];
    lable.text=@"等级数据分析";
    lable.frame=CGRectMake(20, Main_Screen_Height*0.3+5, Main_Screen_Width, 20);
    [self.view addSubview:lable];
    
    static NSNumberFormatter *barChartFormatter;
    if (!barChartFormatter) {
        barChartFormatter = [[NSNumberFormatter alloc] init];
        barChartFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
        barChartFormatter.allowsFloats = NO;
        barChartFormatter.maximumFractionDigits = 0;
    }
    
    self.barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, Main_Screen_Height*0.3+61.0, SCREEN_WIDTH, 200.0)];
    //        self.barChart.showLabel = NO;
    self.barChart.yLabelFormatter = ^(CGFloat yValue) {
        return [barChartFormatter stringFromNumber:@(yValue)];
    };
    
    self.barChart.yChartLabelWidth = 20.0;
    self.barChart.chartMarginLeft = 30.0;
    self.barChart.chartMarginRight = 10.0;
    self.barChart.chartMarginTop = 5.0;
    self.barChart.chartMarginBottom = 10.0;
    
    
    self.barChart.labelMarginTop = 5.0;
    self.barChart.showChartBorder = YES;
    [self.barChart setXLabels:@[@"2", @"3", @"4", @"5", @"2", @"3", @"4", @"5"]];

    [self.barChart setYValues:@[@10.00, @2.00, @6.00, @14.00, @10.00, @1.00, @6.00, @22.00]];
    [self.barChart setStrokeColors:@[PNGreen, PNGreen, PNRed, PNGreen, PNGreen, PNGreen, PNRed, PNGreen]];
    self.barChart.isGradientShow = NO;
    self.barChart.isShowNumbers = NO;
    
    [self.barChart strokeChart];
    
    self.barChart.delegate = self;
    
    [self.view addSubview:self.barChart];
    
    UIView *view=[UIView new];
    view.backgroundColor=[UIColor whiteColor];
    view.frame=CGRectMake(0,  Main_Screen_Height*0.3+61.0, 20, 200);
    [self.view addSubview:view];
}


@end
